import { Random } from 'mockjs';

const doCustomTimes=(times, callback)=> {
    let i = -1;
    while (++i < times) {
        callback(i);
    }
}

const tableList = (pageSize) => {
    const result = [];
    doCustomTimes(pageSize, () => {
        result.push({
            id: Random.id(),
            name:Random.cname(),
            router:Random.url(),
            desc:Random.cparagraph(),
            order:Random.integer(0,50)
        });
    });
    return result;
};


export default [
    {
        url:"/api/menulist/",
        method: 'get',
        response:({query})=>{
            const { page = 1, pageSize = 50 } = query;
            const list = tableList(Number(pageSize));
            return {
               code:0,
                msg:"获取成功",
                data:{},
                items:list,
                total:100,
            }
        }
    },
]